fix(banner): make hidden content inert and fix live region semantics - #5056
Open
lukemorawski wants to merge 6 commits into
Open
fix(banner): make hidden content inert and fix live region semantics#5056lukemorawski wants to merge 6 commits into
lukemorawski wants to merge 6 commits into
Conversation
MikitasK
reviewed
Aug 18, 2026
MikitasK
left a comment
There was a problem hiding this comment.
looks pretty solid 👍
just a few points to address before merge:
JKobrynski
reviewed
Aug 19, 2026
lukemorawski
force-pushed
the
feat/banner-a11y-inert-when-hidden
branch
from
August 21, 2026 11:11
cc2bc30 to
5181930
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Bannerwas only visually hidden but content stayed mounted, screen readers could still reach it, and action buttons remained tabbable. The live region also had conflicting semantics and simply didn't work on Android.aria-hidden,pointerEventsguard orinert. Withvisible={false}, both actions still hadtabIndex: 0and accepted focus in the browser a11y tree.role="alert"+aria-live="polite"didn't agree.alertimplies assertive + atomic, while Chrome ended up withalert atomic live="polite".aria-live→accessibilityLiveRegiononView, notText, so the prop was ignored by the native text node. In practice it only worked on web.actionswas unbounded, and animation callbacks fired on mount and ontheme.animation.scalechanges even when visibility didn't change. Two existing tests already called this out as probably a bug.Related issue
Fixes #5055
Part of #4990
Changes
Inertness. Content becomes
aria-hidden+pointerEvents="none"+inerton web as soon as hiding starts, then unmounts after the exit animation - basically the same lifecycleSnackbaralready uses. There's still one inert measuring pass when mounting hidden so the spacer gets the right height. Layout stays the same.Live region. Moved from
Textto aView, which makes it actually work on Android. It's also scoped to the message only, so action labels don't re-announce the whole banner.roleandaria-livenow match.New
urgentprop.falseby default:role="status"+aria-live="polite"true:role="alert"+aria-live="assertive"On iOS the message is announced explicitly with
announceForAccessibilityWithOptions({ queue: !urgent }): queued for normal banners, interrupting for urgent ones. This is iOS-only to avoid double announcements elsewhere. Interpolated children like<Banner>Hello {name}</Banner>are flattened before announcing.Actions. Limited to 2, with a development warning for extras. They can now sit inline with the message when there's enough room instead of always dropping below it.
Focus. If a focused action disappears, focus moves to the nearest remaining action, or the message region if there are none. During hiding the content is inert, so focus is simply released. Restoring it to whatever opened the banner needs consumer-owned API/state and is out of scope here.
Callbacks.
onShowAnimationFinished/onHideAnimationFinishednow only run after actualvisibletransitions - not on mount, animation-scale changes, or interrupted animations.Breaking changes
Test plan
yarn typecheckyarn lintyarn test- 55 suites, 760 tests. Banner coverage went from 13 to 41 tests; the two "probably a bug" tests were inverted rather than removed.expo start --web)Hidden state, browser a11y tree. Before, both actions were still focusable:
Afterwards the message and actions disappear from the tree completely. The page tab count drops by exactly those two buttons (from 31 to 29), then returns when the banner is shown again.
Visible state.
alert atomic live="polite"becomesstatus atomic live="polite". The live region contains only the message; buttons are siblings.Android / TalkBack. The native a11y tree contains
banner-content, message and actions while visible, and none of them while hidden.iOS / VoiceOver. Full show > hide > show cycle gives message + actions >
[]> message + actions again. Theurgentannouncement was also checked.